package demo6;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Demo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext("demo6");
        Person p1 = context.getBean(Person.class);
        Person p2 = context.getBean(Person.class);
        /*
        * spring管理对象时默认单例模式
        * 即每个对象在spring容器中仅有一个实例,重复获取相同对象时重复使用*/

        System.out.println(p1);
        System.out.println(p2);

    }
}
